from moviepy.audio.io.AudioFileClip import AudioFileClip
from moviepy.video.io.VideoFileClip import VideoFileClip
import os


def mergeAudioVideo(audioPath, imagesVideoPath, savePath):
    video = VideoFileClip(imagesVideoPath)
    audio = AudioFileClip(audioPath)
    merge = video.set_audio(audio)
    merge.write_videofile(savePath)
    video.close()
    audio.close()
    os.remove(audioPath)
    os.remove(imagesVideoPath)